define(["jquery","bbcare",
    "scprit/followup/app/prematureOvarianFailure/prematureOvarianFailureList.servers.js",
    "scprit/followup/app/prematureOvarianFailure/prematureOvarianFailureList.ui.js",
    "scprit/followup/app/comm/page/page.js"],function($,$bb,$servers,$ui,$page){
    var event = {};
    event.searchFn = function(page,rows){
        var inParams = {
            "examinationPaperName":"GLE;LES;OSI;DGLE",//'GLE;LES;OSI;DGLE',
            "patientName": $.trim($("#patientName").val()),
            "phoneNum":$.trim($("#phone").val()),
            "beginTime":$.trim($("#fromTime").val()),
            "endTime":$.trim($("#endTime").val()),
            "page":page,
            "rows":rows
        };
        var getQuesListCallback = function(data){
            if(data.success){
                var pages = Math.ceil(data.data.total/rows);
                var lens = data.data.rows.length;
                if( lens <= rows*1){
                    for(var i=0;i<(rows - lens);i++){
                        data.data.rows.push({});
                    }
                }
                $ui.prematureOvarianFailureListInit({"id":"#listArea","data":data.data.rows});
                $page.init({
                    id:"page-turn",
                    pagesAll:pages,
                    page:page
                });
                $("#page-turn .btn").click(function(){
                    var text = $(this).text();
                    page = $page.getPageActive({
                        "pageClick":text,
                        "page":page,
                        "pagesAll":pages
                    });
                    event.searchFn(page,rows);
                });

            }else{
                $bb.toastShow(data.msg,1500);
            }
        };
        $servers.getQuesList(inParams,getQuesListCallback);
    };
    return event;
});